#!/bin/bash

CJSDK=/Users/sunjiaqi/Desktop/cj_sdk/527/cangjie_android
source $CJSDK/envsetup.sh
chmod 755 $CJSDK/

#ANDROID_NDK=/Users/sunjiaqi/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/
#ANDROID_CLANG=$ANDROID_NDK/bin/clang++
#ANDROID_SYSROOT=$ANDROID_NDK/sysroot
#ANDROID_LLVM_LIBS1=$ANDROID_NDK/lib64/clang/14.0.7/lib/linux
#ANDROID_LLVM_LIBS2=$ANDROID_NDK/sysroot/usr/lib/aarch64-linux-android/31
#
SCRIPT_PATH=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
cd $SCRIPT_DIR

#$ANDROID_CLANG ./cj2java/*.cpp -o ./cj2java/out/libjavaMirror.so -llog --target=aarch64-linux-android -shared -fPIC -I $ANDROID_SYSROOT -I $ANDROID_SYSROOT/usr/include/ -L $ANDROID_LLVM_LIBS2 -B $ANDROID_LLVM_LIBS2

cjpm build --target=aarch64-linux-hos31 -V

#cjpm build --no-feature-deduce --enable-features=feature.env.android --target=aarch64-linux-hos31

cp $SCRIPT_DIR/target/aarch64-linux-hos31/release/cangjie/libcjClearMsg.so $SCRIPT_DIR/../../../libs/arm64-v8a/
#cp $SCRIPT_DIR/cj2java/out/*.so $SCRIPT_DIR/../../../libs/arm64-v8a/


